package wang.naifei.core.utils.office.excel;/*
 * <h3>Title:BS-CRD系统</h3>
 * <p>Copyright (c) 2022, wnfbx@163.com. All rights reserved.</p>
 * @author wnfbx@163.com
 */


import java.util.HashSet;
import java.util.Set;

/**
 * <dt>Description:CellIndex</dt>
 * <dd>列索引</dd>
 *
 * @author wnfbx@163.com
 * @version 1.0 <i>2022/5/26 11:23</i>
 * @since jdk1.7+
 */
public class CellIndexInFile {

    private Set<Integer> cellsIndex;

    private CellIndexInFile() {
        cellsIndex = new HashSet<>();
    }

    /**
     * <dt>Description:form</dt>
     * <dd>创建索引</dd>
     * <dd>author: wnfbx@163.com</dd>
     * <dd>version:1.0 <i>2022/5/27 20:47</i></dd>
     *
     * @param cellsIndex excel的列索引，从A开始
     * @return wang.naifei.core.utils.office.excel.CellIndexInFile
     * @since jdk1.8+
     */
    public static CellIndexInFile form(String... cellsIndex) {
        return new CellIndexInFile().add(ExcelUtils.allCellKeyToIndex(cellsIndex));
    }

    /**
     * <dt>Description:add</dt>
     * <dd></dd>
     * <dd>author: wnfbx@163.com</dd>
     * <dd>version:1.0 <i>2022/5/27 20:45</i></dd>
     *
     * @param cellsIndex 程序索引从0开始
     * @return wang.naifei.core.utils.office.excel.CellIndexInFile
     * @since jdk1.8+
     */
    public CellIndexInFile add(int... cellsIndex) {
        for (int i : cellsIndex) {
            this.cellsIndex.add(i);
        }
        return this;
    }


    public Set<Integer> getCellsIndex() {
        return cellsIndex;
    }
}
